package com.mvc4g.example.client;

import com.mvc4g.client.ActionInterface;
import com.mvc4g.client.Controller;

public class OperationAction implements ActionInterface {
	
	private int value = 0;

	@Override
	public void execute(Controller controller, Object form) {

		//Execute action
		String operation = (String) form;
		if("+".equals(operation)){
			value++;
		}
		else if("-".equals(operation)){
			value--;
		}
		
		//Update the view
		((SimpleCalculatorView)controller.getView("mainView")).updateScreen(Integer.toString(value));

	}

}
